/*
  true: check if true case works ( i.e. 4<5 should be true)
  false: check if false case works (i.e. 5<4 should be fase )

 for all conditionals (<,==,<=,>,>) compare using the following cases
  1) variable vs variable	(u,i,f)		(true,false)
  2) variable vs constant	(u,i,f)		(true,false)
  3) constant vs variable
  4) constant vs constant
  5) variable vs arithmetic operation
  6) constant vs arithmetic operation
  
 LIMITS
 u: 0 -> 2^32
 i: -2^32 -> 2^32-1
 f: -32768.0000 -> 32767.9999
*/



var ulow = new Array( 1,2,3,5,6,10,20,30,50,30,100,4233);
var umid = new Array(5000,6000,7000,8000,10000,11111,12000);
var uhigh = new Array(20000,21000,22222,23333,24233,25233);
//var umaximum = new Array(3234343234,243423433);

var ilow = new Array( 1,3,5,6,10,20,30,50,30,100);
var imid = new Array(5000,6000,7000,8000,10000,11111,12000);
var ihigh = new Array(20000,21000,22222,23333,24233,25233);

var flow = new Array(1.23,3.23,5.23,6.23,10.2343,20.2343,30.232,50.233);
var fmid = new Array(5000.23,6000.23,7000.23,8000.23,1000.2,11111.23,12000.23);
var fhigh = new Array( 22000.23,21000.00,22222.2343,23333.23,24232.12,25232.1);


var ilowneg = new Array(-20000,-21000,-22222,-23333,-24233,-25233);
var imidneg = new Array(-5000,-6000,-7000,-8000,-10000,-11111,-12000);
var ihighneg = new Array(-1,-3,-5,-6,-10,-20,-30,-50,-30,-100);

// these arrays don't get shuffled
var uvarstatic = new Array( 1,2,3,5,6,10,20,30,50,30,100,4233);
var fvarstatic = new Array( 1.00,2.00,3.00,5.00,6.00,10.00,20.00,30.00,50.00,30.00,100.00,4233.00);
var ivarstatic = new Array( 1,2,3,5,6,10,20,30,50,30,100,4233);



var totalCases=1;
var globalCount=1;




function writeSummary()
{
	printf('DisplayLine(" ")');
	printf('DisplayLine("TOTAL: ",count)');
	printf('DisplayLine("GOOD:  ", good )');
	printf('DisplayLine("BAD :  ", bad ) ' );
	printf('Wait(2000)');
	printf('WriteLine(fd,"GOOD: ",good," of ", count) ' );
	printf('WriteLine(fd,"BAD : ",bad ," of ", count) ' );


}


function trueVarNum(varName, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			
			if( trueVarNum.arguments.length <= 5)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', trueVarNum.arguments[5] );
			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',lvar[i] );
			printf('if ',varName, op ,rvar[i] );
			printf('state =1 ');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');
			printf('end');
			printf('if state == 0');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');
			printf('<br>');

		}

}

/* constant is on left hand side i.e. if 3.45 < uvar 
 * constant = lvar
 * variable = rvar
 * so for easy readibility
 * think, operation (op), then lvar op rvar, i.e. lvar < rvar
 */
 
function trueNumVar(varName, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			
			if( trueNumVar.arguments.length <= 5)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', trueNumVar.arguments[5] );
			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',rvar[i] );
			printf('if ',lvar[i], op ,varName );
			printf('state =1 ');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');
			printf('end');
			printf('if state == 0');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');
			printf('<br>');

		}

}

function trueVarVar(varName,varName2, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			
			if( trueVarVar.arguments.length <= 6)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ',trueVarVar.arguments[6] );
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',lvar[i] );
			printf(varName2,' = ',rvar[i] );

			printf('if ',varName, op ,varName2 );
			printf('state =1 ');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');
			printf('end');
			printf('if state == 0');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');
			printf('<br>');

		}

}

/*
 * Compares a constant to a constant
 * i.e. lvar op rvar <=>  5.23 < 31.23
 */
function trueNumNum( op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			
			if( trueNumNum.arguments.length <= 4)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', trueNumNum.arguments[4] );
			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');

			printf('if ',lvar[i], op ,rvar[i]);
			printf('state =1 ');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');
			printf('end');
			printf('if state == 0');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');
			printf('<br>');

		}

}

function falseVarNum(varName, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			if( falseVarNum.arguments.length <= 5)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', falseVarNum.arguments[5]);
			
			
			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',lvar[i] );
			printf('if ',varName, op ,rvar[i] );
			printf('state =1 ');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');

			printf('if state == 0');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');

			printf('end');
			printf('<br>');

		}

}




/*
 * constant is on left hand side, i.e. if 3.45 < uvar
 */
function falseNumVar(varName, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			if( falseNumVar.arguments.length <= 5)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', falseNumVar.arguments[5]);
			
			
			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',rvar[i] );
			printf('if ',lvar[i], op , varName);
			printf('state =1 ');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');

			printf('if state == 0');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');

			printf('end');
			printf('<br>');

		}

}



function falseVarVar(varName,varName2, op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{

			if( falseVarVar.arguments.length <= 6)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', falseVarVar.arguments[6] );
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');
			printf(varName,' = ',lvar[i] );
			printf(varName2,' = ',rvar[i] );
			printf('if ',varName, op ,varName2 );
			printf('state =1 ');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');

			printf('if state == 0');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');

			printf('end');
			printf('<br>');

		}

}


/*
 * Compares a constant to a constant
 * i.e. lvar op rvar <=>  5 < 1.23
 */
function falseNumNum( op, lvar, rvar, melrose )
{
		
		for( i= 0 ; i<melrose ; i++)
		{
			
			if( falseNumNum.arguments.length <= 4)
			printf('# *** ',globalCount,' *** ' );
			else 
			printf('# *** ',globalCount,' *** ', falseNumNum.arguments[4] );			
			globalCount++;

			printf('state=0 ');
			printf('count = count + 1');

			printf('if ',lvar[i], op ,rvar[i]);
			printf('state =1 ');
			printf('bad = bad + 1');
			printf('DisplayLine(count," *** BAD *** ") ')
			printf('WriteLine(fd,count," *** BAD *** ") ');
			printf('end');			
			
			printf('if state == 0');
			printf('Display(".") ');
			printf('WriteLine(fd,count," OK ")');
			printf('good = good + 1');
			printf('end');
			printf('<br>');

		}

}

shuffle(ulow);
shuffle(umid);
shuffle(uhigh);

shuffle(ilow);
shuffle(imid);
shuffle(ihigh);

shuffle(flow);
shuffle(fmid);
shuffle(fhigh);

shuffle(ilowneg);
shuffle(imidneg);
shuffle(ihighneg);

